<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTML表单和表格标签的应用</title>
</head>
<body>
    <p>表格是用来显示二维数据的重要标签</p>
    <hr>
    <p>构建2行3列的表格</p>
    <!--border之类的属性是不推荐使用的-->
    <table border="1">
        <tr>
            <td>单元格</td>
            <td>单元格</td>
            <td>单元格</td>
        </tr>
        <tr>
            <td>单元格</td>
            <td>单元格</td>
            <td>单元格</td>
        </tr>
    </table>
    <hr>
    <p>构建喊caption/thead/tbody/tfoot的表格</p>
    <table border="1">
        <caption>学生信息表</caption>
        <thead>
            <td>学号</td>
            <td>姓名</td>
            <td>总分</td>
            <td>排名</td>
        </thead>
        <tbody>
            <tr>
                <td>20210203471</td>
                <td>张三</td>
                <td>620</td>
                <td>2</td>
            </tr>
            <tr>
                <td>20210203472</td>
                <td>李四</td>
                <td>630</td>
                <td>1</td>
            </tr>

            
            <tr>
                <td>20210203473</td>
                <td>王五</td>
                <td>600</td>
                <td>3</td>
            </tr>
        </tbody>
        <tfoot>
            <tr>
                <td>统计：</td>
                <td>空白</td>
                <td>空白</td>
                <td>空白</td>
            </tr>
        </tfoot>
    </table>
    <hr>
    <p>构建喊caption/thead/tbody/tfoot的表格,th标签显示单元格为表头（加粗）</p>
    <table border="1">
        <caption>学生信息表</caption>
        <thead>
            <tr>
               <td>&nbsp;</td>
               <th>学号</th>
               <th>姓名</th>
               <th>总分</th>
               <th>排名</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <th>1</th>
                <td>20210203471</td>
                <td>张三</td>
                <td>620</td>
                <td>2</td>
            </tr>
            <tr>
                <th>2</th>
                <td>20210203472</td>
                <td>李四</td>
                <td>630</td>
                <td>1</td>
            </tr>
            <tr>
                <th>3</th>
                <td>20210203473</td>
                <td>王五</td>
                <td>600</td>
                <td>3</td>
            </tr>
        </tbody>
        <tfoot>
            <tr>
                <!--<td>统计：</td>
                <td>空白</td>
                <td>空白</td>-->
                <td colspan="5">统计：</td>
            </tr>
        </tfoot>
    </table>

    <p>表单表示文档中的一个区域，此区域包含交互控件，将用户收集到的信息发送到 Web 服务器</p>
    <hr>
    <p>表格列分组</p>
    <table border="1">
        <colgroup>
            <col span="2">
            <col span="3">
        </colgroup>
        <tr>
            <td>分组1</td>
            <td>分组1</td>
            <td>分组2</td>
            <td>分组2</td>
            <td>分组2</td>
        </tr>
        <tr>
            <td>分组1</td>
            <td>分组1</td>
            <td>分组2</td>
            <td>分组2</td>
            <td>分组2</td>
        </tr>
        <tr>
            <td>分组1</td>
            <td>分组1</td>
            <td>分组2</td>
            <td>分组2</td>
            <td>分组2</td>
        </tr>
    </table>

    <!--GET与POST是两种提交数据的方法-->
    <form action="#" name="my_form" method="post">
        <fieldset>
            <legend>基本信息</legend>
            <label for="truename">姓名</label>
            <!--单行文本输入框-->
            <input type="text" name="truename" id=""truename value="测试数据">
            <lable for="nickname">昵称</lable>
            <input type="text" name="nickname" id="nickname">
            <label for="password">密码</label>
            <!--input:密码框-->
            <input type="password" name="password" id="password">
            <!--input:单选框-->
            <label for="female">女</label>
            <input type="radio" name="sex" id="female" checked>
            <label for="male">男</label>
            <input type="radio" name="sex" id="male">
        </fieldset>

        <fieldset>
            <legend>附加信息</legend>
            <label>兴趣爱好
                <!--input:多选框-->
            <input type="checkbox" name="favorite[]" id="sport">运动
            <input type="checkbox" name="favorite[]" id="music">音乐
            </label>
            <label for="school">毕业学校
                <!--input:下拉列表-->
                <select name="school" id="school">
                    <optgroup label="全国一流大学">
                        <option value="清华">清华大学</option>
                        <option value="北大" selected>北大</option>
                    </optgroup>
                    <optgroup label="省属一流大学">
                        <option value="南大">南大</option>
                    </optgroup>
                    <optgroup label="地方院校">
                        <option value="九院">九江学院</option>
                    </optgroup>
                </select>
            </label>
        </fieldset>

        <fieldset>
            <legend>附件</legend>
            <!--input:文件上传-->
            <input type="file" name="upload_file" id="upload_file">
            <!--input:隐藏域 多用于动态网页编程需要提交一些无需实现的消息-->
            <input type="hidden" name="user" value="admin">
        </fieldset>

        <fieldset>
            <legend>备注(通过JS变成富文本的编辑器)</legend>
            <!--多行文本输入框-->
            <textarea name="note" id="note" cols="30" rows="10"></textarea>
        </fieldset>

    </form>
</body>
</html>